<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>ZJCA客户端“文件和目录操作”DEMO</title>

<!--UI式样文件-->
<link href="./style.css" rel="stylesheet" type="text/css">

<!--ZJCA客户端相关的JS文件-->
<script src="../../zjca_cmt/jquery.min.js" type="text/javascript"></script>
<script src="../../zjca_cmt/zjcacmt.js" type="text/javascript"></script>
<script src="../../zjca_cmt/zjcacmt_cert.js" type="text/javascript"></script>
<script src="../../zjca_cmt/zjcacmt_key.js" type="text/javascript"></script>
<script src="../../zjca_cmt/zjcacmt_com.js" type="text/javascript"></script>
<script src="../../zjca_cmt/zjcacmt_npapi.js" type="text/javascript"></script>
<script src="../../zjca_cmt/zjcacmt_websocket.js" type="text/javascript"></script>
<script src="../../zjca_cmt/zjcacmt_def.js" type="text/javascript"></script>
<script src="../../zjca_cmt/zjcacmt_err.js" type="text/javascript"></script>

<script type="text/javascript">

	/* ZJCA 客户端插件对象 */
	var g_ZjcaCMT = null;
	/* 当前枚举到的设备列表 */
	var g_UsingDeviceArray = null
	/* 当前使用的设备索引 */
	var g_UsingDeviceIndex = -1;

	var g_UsingDeviceFileArray = null;

	var g_UsingDeviceFileIndex = -1;
	/*
	 *	页面初始化
	 */
	 window.onload = function() {
		//创建ZJCA客户端控件对象
		g_ZjcaCMT = new zjca_CMT(onCallbackKeyEvent, null);
		
		//设置客户端交互协议，在初始之前设置生效
		g_ZjcaCMT.setProtocol(PROTOCOL_HTTPS);
		
		//初始化ZJCA控件对象
		var resp = g_ZjcaCMT.init(ZJCA_PRODUCT_CMT, 1);
		if (resp.code != 0) {
			alert("初始化ZJCA客户端失败！\n错误信息：" + resp.msg);
		}else {
			//显示版本信息
			resp = g_ZjcaCMT.getVersion();
			if (resp.code == 0) {
				document.getElementById('txtInfo').innerHTML = "客户端版本：" + resp.res;
			}else {
				document.getElementById('txtInfo').innerHTML = "客户端版本：未知";
			}
			
			//获取设备列表
			resp = g_ZjcaCMT.getKeyList(false);
			if (resp.code != 0) {
				ShowErrorMessage("g_ZjcaCMT.getKeyList()失败！", resp.code);
			}else {
				FillDeviceList(resp.res);
			}
			
			//获取证书列表(所有介质内的所有证书)
			resp = g_ZjcaCMT.getCertList(-1, 0, 0);
			if (resp.code != 0) {
				ShowErrorMessage("g_ZjcaCMT.getCertList()失败！", resp.code);
			}else {
				g_UsingCertArray = resp.res;
			}
		}
	}
	/*
	 *	页面关闭
	 */
	window.onunload = function() {
		/* 释放接口 */
		if (g_ZjcaCMT) {
			g_ZjcaCMT.finaled();
		}
	}
	/*
	 *  列出设备
	 */
	function FillDeviceList(keyArray) {	
		// 删除老的选项
		var selKeyCtrl = document.getElementById('selKeys');
		var itemCount = selKeyCtrl.options.length;
		for (var n = 0; n < itemCount; n++) {
			selKeyCtrl.options.remove(0);
		}
		
		// 保存当前选择的设备
		var selDeviceSN;
		if (g_UsingDeviceIndex >= 0) {			
			selDeviceSN = g_UsingDeviceArray[g_UsingDeviceIndex].getSN();
		}	
		
		g_UsingDeviceArray = keyArray;		
		
		// 更新列表
		if (g_UsingDeviceArray && g_UsingDeviceArray.length > 0) {
			selKeyCtrl.options.add(new Option('请选择UKey设备', -1));

			for (var n = 0; n < g_UsingDeviceArray.length; n++) {
				var keySN = g_UsingDeviceArray[n].getSN();
				var keyLabel = g_UsingDeviceArray[n].getLabel();
				var text = keyLabel + "(" + keySN + ")";
				selKeyCtrl.options.add(new Option(text, n));
			}
		}
		else {
			selKeyCtrl.options.add(new Option('未发现任何ZJCA UKey设备', -1));
			document.form1.selKeys.options[0].selected = true;
			OnSelKeyChanged();
			return;
		}

		// 设置选中的设备
		var i = 0;
		if (g_UsingDeviceIndex >= 0) {
			for (i = 0; i < g_UsingDeviceArray.length; i++) {
				if (selDeviceSN == g_UsingDeviceArray[i].getSN()) {
					document.form1.selKeys.options[i].selected = true;
					g_UsingDeviceIndex = i;
					break;
				}
			}
		}
		if (i == g_UsingDeviceArray.length) {
			document.form1.selKeys.options[0].selected = true;
			OnSelKeyChanged();
		}
	}

	/*
	 *	设备事件响应函数
	 */	
	function onCallbackKeyEvent(type, index, name) {
		// 重新获取设备列表
		var resp = g_ZjcaCMT.getKeyList(false);	
		if (resp.code == 0) {
			FillDeviceList(resp.res);
		}	
			
		//获取证书列表(所有介质内的所有证书)
		resp = g_ZjcaCMT.getCertList(-1, 0, 0);
		if (resp.code == 0) {
			g_UsingCertArray = resp.res;
		}
	}
	/*
	 *	刷新设备列表
	 */
	function OnRefreshKey() {
		var resp = g_ZjcaCMT.getKeyList(true);	
		if (resp.code == 0) {
			FillDeviceList(resp.res);
		}	
			
		//获取证书列表(所有介质内的所有证书)
		resp = g_ZjcaCMT.getCertList(-1, 0, 0);
		if (resp.code == 0) {
			g_UsingCertArray = resp.res;
		}		
	}

	/*
	 *  选择设备，列出选中设备的基本信息
	 */
	function OnSelKeyChanged() {
		// document.form1.txtSN.value = "";
		// document.form1.txtLabel.value = "";
		
		g_UsingDeviceIndex = Number(document.getElementById("selKeys").value);			
		if (g_UsingDeviceIndex < 0 || g_UsingDeviceIndex >= g_UsingDeviceArray.length) {
			return;
		}
		// document.form1.txtSN.value = g_UsingDeviceArray[g_UsingDeviceIndex].getSN();
		// document.form1.txtLabel.value = g_UsingDeviceArray[g_UsingDeviceIndex].getLabel();	
	}

	function OnSelDeviceFileChanged() {
		g_UsingDeviceFileIndex = Number(document.getElementById("selDeviceFiles").value);			
		if (g_UsingDeviceFileIndex < 0 || g_UsingDeviceFileIndex >= g_UsingDeviceFileArray.length) {
			return;
		}
		document.form1.txtDeviceFileName.value = g_UsingDeviceFileArray[g_UsingDeviceFileIndex].getName();
	}
	/*
	 *	页面关闭
	 */
	window.onunload = function() {
		/* 释放接口 */
		if (g_ZjcaCMT) {
			g_ZjcaCMT.finaled();
		}
	}
	/*
	 *	选择要读取的文件名
	 */
	function on_btnOpenSrcFile() {
		if (g_ZjcaCMT == null) {
			alert("g_ZjcaCMT is NULL!");
			return;
		}
		
		//选择要读取的文件名
		var resp = g_ZjcaCMT.getFileName(true, 	      //读取操作
									     "打开文件",  //Caption
										 "*.txt"      //Filter
										 );
		//文件选择成功
		if (resp.code == 0) {
			document.form1.txtSrcFileName.value = resp.res;
		}else {	//文件选择失败
			ShowErrorMessage("g_ZjcaCMT.getFileName()失败!", resp.code);		
		}
	}
	/*
	 *	读取文件内容
	 */
	function on_btnReadSrcFile() {
		if (g_ZjcaCMT == null) {
			alert("g_ZjcaCMT is NULL!");
			return;
		}
		var srcFile = document.form1.txtSrcFileName.value;
		if (srcFile.length == 0) {
			alert("文件名不能为空！");
			return;			
		}
		
		// 读取文件
		var resp = g_ZjcaCMT.readFile(srcFile //文件名
									 );
		if (0 == resp.code) {	//读取成功	
			document.form1.txtSrcFileContent.value = resp.res;		
		}else {			//格式化失败
			ShowErrorMessage("g_ZjcaCMT.readFile()失败!", resp.code);
		}
	}	
	/*
	 *	选择要保存的文件名
	 */
	function on_btnOpenDesFile() {
		if (g_ZjcaCMT == null) {
			alert("g_ZjcaCMT is NULL!");
			return;
		}
		
		//选择要读取的文件名
		var resp = g_ZjcaCMT.getFileName(false, 	  //保存操作
									     "保存文件",  //Caption
										 ""           //Filter
										 );
		//文件选择成功
		if (resp.code == 0) {
			document.form1.txtDesFileName.value = resp.res;
		}else {	//文件选择失败
			ShowErrorMessage("g_ZjcaCMT.getFileName()失败!", resp.code);		
		}
	}
	/*
	 *	写文件内容
	 */
	function on_btnWriteDesFile() {
		if (g_ZjcaCMT == null) {
			alert("g_ZjcaCMT is NULL!");
			return;
		}
		var desFile = document.form1.txtDesFileName.value;
		if (desFile.length == 0) {
			alert("文件名不能为空！");
			return;			
		}
		var fileContent = document.form1.txtDesFileContent.value;
		if (fileContent.length == 0) {
			alert("文件内容不能为空！");
			return;			
		}
		
		// 写文件
		var resp = g_ZjcaCMT.writeFile(desFile,      //文件名
									   fileContent,  //文件内容
									   true         //直接保存字符串
		                               );
		if (0 == resp.code) {	//写文件成功	
			alert("写文件成功！");	
		}else {			//写文件失败
			ShowErrorMessage("g_ZjcaCMT.writeFile()失败!", resp.code);
		}
	}
	/*
	 *	删除文件
	 */		
	function on_btnDeleteDesFile() {	
		if (g_ZjcaCMT == null) {
			alert("g_ZjcaCMT is NULL!");
			return;
		}
		var desFile = document.form1.txtDesFileName.value;
		if (desFile.length == 0) {
			alert("文件名不能为空！");
			return;			
		}
		
		// 删除文件
		var resp = g_ZjcaCMT.deleteFile(desFile      //文件名
		                               );
		if (0 == resp.code) {	//删除文件成功	
			alert("文件删除成功！");	
		}else {			//删除文件失败
			ShowErrorMessage("g_ZjcaCMT.deleteFile()失败!", resp.code);
		}
	}
	/*
	 *	创建目录
	 */	
	function on_btnCreateDesPath() {
		if (g_ZjcaCMT == null) {
			alert("g_ZjcaCMT is NULL!");
			return;
		}
		var desPath = document.form1.txtDesPathName.value;
		if (desPath.length == 0) {
			alert("目录名不能为空！");
			return;			
		}
		
		// 创建目录
		var resp = g_ZjcaCMT.createFolder(desPath //目标目录名		
										  );
		if (0 == resp.code) {	//目录创建成功	
		    // 打开新建的文件夹
			resp = g_ZjcaCMT.openFolder(desPath);
			if (0 != resp.code) {
				ShowErrorMessage("目录已创建成功，但是打开该目录时失败！g_ZjcaCMT.openFolder()失败!", resp.code);			
			}
		}else {			//格式化失败
			ShowErrorMessage("g_ZjcaCMT.createFolder()失败!", resp.code);
		}	
	}
	/*
	 *	选择目录名
	 */
	function on_btnSelDelPath() {
		if (g_ZjcaCMT == null) {
			alert("g_ZjcaCMT is NULL!");
			return;
		}
		
		//选择目录名
		var resp = g_ZjcaCMT.getPathName("选择目录",  //Caption
										 ""			  //Default
										 );
		//目录名选择成功
		if (resp.code == 0) {
			document.form1.txtDelPathName.value = resp.res;
		}else {	//目录名选择失败
			ShowErrorMessage("g_ZjcaCMT.getPathName()失败!", resp.code);		
		}
	}	
	/*
	 *	删除目录
	 */	
	function on_btnDeletePath() {
		if (g_ZjcaCMT == null) {
			alert("g_ZjcaCMT is NULL!");
			return;
		}
		var delPath = document.form1.txtDelPathName.value;
		if (delPath.length == 0) {
			alert("目录名不能为空！");
			return;			
		}
		
		// 删除目录
		var resp = g_ZjcaCMT.deleteFolder(delPath //待删除的目录		
										  );
		if (0 == resp.code) {	//目录删除成功	
			alert("目录删除成功!");	
		}else {			//格式化失败
			ShowErrorMessage("g_ZjcaCMT.deleteFolder()失败!", resp.code);
		}	
	}

	/*
	 *	获取设备文件列表
	 */
	function FillDeviceFileList(fileArray)
	{
		// 删除老的选项
		var selDeviceFileCtrl = document.getElementById('selDeviceFiles');
		var itemCount = selDeviceFileCtrl.options.length;
		for (var n = 0; n < itemCount; n++) {
			selDeviceFileCtrl.options.remove(0);
		}
		
		// 保存当前选择的设备文件
		var selDeviceFileInfo;
		if (g_UsingDeviceFileIndex >= 0) {			
			selDeviceFileInfo = g_UsingDeviceFileArray[g_UsingDeviceFileIndex].getName();
		}	
		
		g_UsingDeviceFileArray = fileArray;		
		
		// 更新列表
		if (g_UsingDeviceFileArray && g_UsingDeviceFileArray.length > 0) {
			selDeviceFileCtrl.options.add(new Option("设备文件总数:" + g_UsingDeviceFileArray.length + "个", -1));

			for (var n = 0; n < g_UsingDeviceFileArray.length; n++) {
				var Filename = g_UsingDeviceFileArray[n].getName();
				var FileSzie = g_UsingDeviceFileArray[n].getSize();
				var text = Filename + "(" + FileSzie + "B)";
				selDeviceFileCtrl.options.add(new Option(text, n));
			}
		}
		else {
			selDeviceFileCtrl.options.add(new Option('未发现任何设备文件', -1));
			document.form1.selDeviceFiles.options[0].selected = true;
			OnSelDeviceFileChanged();
			return;
		}

		// 设置选中的设备
		var i = 0;
		if (g_UsingDeviceFileIndex >= 0) {
			for (i = 0; i < g_UsingDeviceFileArray.length; i++) {
				if (selDeviceFileInfo == g_UsingDeviceFileArray[i].getName()) {
					document.form1.selDeviceFiles.options[i].selected = true;
					g_UsingDeviceFileIndex = i;
					break;
				}
			}
		}
		if (i == g_UsingDeviceFileArray.length) {
			document.form1.selDeviceFiles.options[0].selected = true;
			OnSelDeviceFileChanged();
		}
	}

	/*
	 *	刷新设备文件列表
	 */
	 function OnRefreshDeviceFile() {			
		//获取证书列表(所有介质内的所有证书)
		if (g_UsingDeviceIndex == -1) {
			alert("请选择设备！");
			return;
		}
		if (!(g_UsingDeviceIndex >= 0 && g_UsingDeviceIndex < g_UsingDeviceArray.length)) {
			alert("设备不存在！");
			return;
		}

		// 读取文件列表
		var resp = g_ZjcaCMT.getDeviceFileList(g_UsingDeviceIndex)
		if (0 == resp.code) {

		}else {			//获取设备文件列表失败
			ShowErrorMessage("g_ZjcaCMT.getDeviceFileList()失败!", resp.code);
		}

		FillDeviceFileList(resp.res);

	}

	function OnInitDeviceFile() {
		//获取证书列表(所有介质内的所有证书)
		if (g_UsingDeviceIndex == -1) {
			alert("请选择设备！");
			return;
		}
		if (!(g_UsingDeviceIndex >= 0 && g_UsingDeviceIndex < g_UsingDeviceArray.length)) {
			alert("设备不存在！");
			return;
		}

		var resp  = g_ZjcaCMT.verifyPin(g_UsingDeviceIndex, ""); 
		if (resp.code == 0) {//校验PIN码成功	
		}else {
			ShowErrorMessage("校验PIN码失败!", resp.code);
			return;
		}

		resp = g_ZjcaCMT.OnInitDeviceFile();
		if (resp.code == 0) {//初始化设备文件列表成功	
		}else {
			ShowErrorMessage("初始化设备文件失败!", resp.code);
			return;
		}

		// 读取文件列表
		resp = g_ZjcaCMT.getDeviceFileList(g_UsingDeviceIndex)
		if (0 == resp.code) {

		}else {			//获取设备文件列表失败
			ShowErrorMessage("g_ZjcaCMT.getDeviceFileList()失败!", resp.code);
		}

		FillDeviceFileList(resp.res);
	}

	/*
	 *	写入文件到设备
	 */	
	 function on_btnWriteFileToDevice() {
		
		if (g_UsingDeviceIndex == -1) {
			alert("请选择设备！");
			return;
		}
		if (!(g_UsingDeviceIndex >= 0 && g_UsingDeviceIndex < g_UsingDeviceArray.length)) {
			alert("设备不存在！");
			return;
		}

		var resp  = g_ZjcaCMT.verifyPin(g_UsingDeviceIndex, ""); 
		if (resp.code == 0) {//校验PIN码成功	
		}else {
			ShowErrorMessage("校验PIN码失败!", resp.code);
			return;
		}	

		var fileName = document.form1.txtDeviceFileName.value;
		if (fileName.length == 0) {
			alert("文件名不能为空！");
			return;			
		}

		var fileContent = document.form1.txtDeviceFileContent.value;
		if (fileContent.length == 0) {
			alert("文件内容不能为空！");
			return;			
		}
		// 写入文件
		resp = g_ZjcaCMT.writeFileToDevice(g_UsingDeviceIndex, fileName,fileContent, false)
		if (0 == resp.code) {	//写入文件成功	
			alert("写入文件成功!");	
		}else {			//写入文件失败
			ShowErrorMessage("g_ZjcaCMT.writeFileFromDevice()失败!", resp.code);
		}	
	}

	/*
	 *	从设备读取文件
	 */	
	 function on_btnReadFileFromDevice() {
		
		if (g_UsingDeviceIndex == -1) {
			alert("请选择设备！");
			return;
		}
		if (!(g_UsingDeviceIndex >= 0 && g_UsingDeviceIndex < g_UsingDeviceArray.length)) {
			alert("设备不存在！");
			return;
		}

		var fileName = document.form1.txtDeviceFileName.value;
		if (fileName.length == 0) {
			alert("文件名不能为空！");
			return;			
		}

		// var resp  = g_ZjcaCMT.verifyPin(g_UsingDeviceIndex, ""); 
		// if (resp.code == 0) {//校验PIN码成功	
		// }else {
		// 	ShowErrorMessage("校验PIN码失败!", resp.code);
		// 	return;
		// }	
		// 从设备读取文件
		var resp = g_ZjcaCMT.readFileFromDevice(g_UsingDeviceIndex, fileName)
		if (0 == resp.code) {	//读取文件成功	
			document.form1.txtDeviceFileContent.value = resp.res;	
		}else {			//读取文件失败
			ShowErrorMessage("g_ZjcaCMT.readFileFromDevice()失败!", resp.code);
		}	
	}
	
	/*
	 *	从设备删除文件
	 */	
	 function on_btnDeleteFileFromDevice() {
		
		if (g_UsingDeviceIndex == -1) {
			alert("请选择设备！");
			return;
		}
		if (!(g_UsingDeviceIndex >= 0 && g_UsingDeviceIndex < g_UsingDeviceArray.length)) {
			alert("设备不存在！");
			return;
		}

		var fileName = document.form1.txtDeviceFileName.value;
		if (fileName.length == 0) {
			alert("文件名不能为空！");
			return;			
		}

		var resp  = g_ZjcaCMT.verifyPin(g_UsingDeviceIndex, ""); 
		if (resp.code == 0) {//校验PIN码成功	
		}else {
			ShowErrorMessage("校验PIN码失败!", resp.code);
			return;
		}	
		// 删除文件
		resp = g_ZjcaCMT.deleteFileFromDevice(g_UsingDeviceIndex,fileName)
		if (0 == resp.code) {	//删除文件成功	
			alert("删除文件成功!");	
		}else {			//删除文件失败
			ShowErrorMessage("g_ZjcaCMT.deleteFileFromDevice()失败!", resp.code);
		}	
	}

	//	显示错误信息函数
	function ShowErrorMessage(msg, code) {
		var errCode = zjca_GetErrHexCode(code);
		var errTxt = zjca_GetErrTxt(code);
	
		var errMsg = msg;
		errMsg += "\n";
		errMsg += "错误代码：";
		errMsg += errCode;
		errMsg += "\n";
		errMsg += "错误信息：";
		errMsg += errTxt;
		alert(errMsg);
	}	
</script>

<meta http-equiv="Access-Control-Allow-Origin" content="*.zjca.com.cn">
<meta name="GENERATOR" content="MSHTML 11.00.9600.17728">
<body screen_capture_injected="true">
	<br>
	<br>
	<h2 align="center">ZJCA客户端“文件和目录操作”DEMO</h2>
	<br>
	<br>
	<form name="form1" action="">
		<fieldset>
			<legend>帮助说明：</legend>
			<td>文件和目录操作包含的功能说明如下：</td><br>
			<td>1、读文件：readFile()</td><br>
			<td>2、写文件：writeFile()</td><br>
			<td>3、删除文件：deleteFile()</td><br>
			<td>4、创建目录：createFolder()</td><br>
			<td>5、使用资源管理器打开目录：openFolder()</td><br>
			<td>6、删除目录：deleteFolder()</td><br>
			<td>7、打开文件选择对话框：getFileName()</td><br>
			<td>8、打开目录选择对话框：getPathName()</td><br>
		</fieldset>
		<br> <br>
		<fieldset>
			<legend>客户端信息：</legend>
			<table>
				<colgroup>
					<col class="col1">
					<col class="col2">
					<col class="col3">
				</colgroup><tbody>
					<tr>
						<td></td>
						<td></td>
						<td></td>
					</tr>
					<tr>
						<td><label name="txtInfo" id="txtInfo" width="500" >未检测到ZJCA客户端程序！</label></td>
					</tr>
				</tbody>
			</table>
		</fieldset>
		<br>
		<fieldset style="width:616px">
			<legend>密码设备</legend>
			<table>
				<colgroup>
					<col class="col1">
					<col class="col2">
					<col class="col3">
				</colgroup><tbody>
					<tr>
						<td></td>
						<td></td>
						<td></td>
					</tr>
					<tr>
						<td>请选择Key：</td>
						<td colspan="2"><select id="selKeys" name="selKeys" onchange="OnSelKeyChanged()"></select></td>
					<TD><INPUT name="btnRefresh" class="keyBtn" onclick="OnRefreshKey()" type="button" value="刷新"></TD>
					</tr>
				</tbody>
			</table>
		</fieldset>
		<br> 
		<legend>一.系统文件操作</legend>
		<fieldset>
			<legend>读文件操作：</legend>
			<td>文件名称：</td>
			<TD>
				<INPUT name="txtSrcFileName" type="text" readonly="readonly" style="width:400px">
				<INPUT name="btnSrcFile" onclick="on_btnOpenSrcFile();" type="button" value="选择">
			</TD>
			<br>
			<td>文件内容：</td><br>
			<tr>
				<TEXTAREA name="txtSrcFileContent" rows="5" cols="70"></TEXTAREA><br>
				<td>
					<input name="btnReadSrcFile" class="keyBtn" onclick="on_btnReadSrcFile()" type="button" value="读取"><br>
				</td>
			</tr>
		</fieldset>		
		<br> <br>
		<fieldset>
			<legend>写文件操作：</legend>
			<td>文件名称：</td>
			<TD>
				<INPUT name="txtDesFileName" type="text" style="width:400px">
				<INPUT name="btnDesFile" onclick="on_btnOpenDesFile();" type="button" value="选择">
			</TD>
			<br>
			<td>文件内容：</td><br>
			<tr>
				<TEXTAREA name="txtDesFileContent" rows="5" cols="70"></TEXTAREA><br>
				<td>
					<input name="btnWriteDesFile" class="keyBtn" onclick="on_btnWriteDesFile()" type="button" value="保存">
					<input name="btnDeleteDesFile" class="keyBtn" onclick="on_btnDeleteDesFile()" type="button" value="删除"><br>
				</td>
			</tr>
		</fieldset>		
		<br> <br>
		<fieldset>
			<legend>目录操作：</legend>
			<td>创建目录：</td>
			<TD>
				<INPUT name="txtDesPathName" type="text" style="width:400px;margin-left:0px;">
				<INPUT name="btnDesPath" onclick="on_btnCreateDesPath();" type="button" value="创建">
			</TD>
			<br>
			<td>删除目录：</td>
			<TD>
				<INPUT name="txtDelPathName" type="text" style="width:400px;margin-left:0px;">
				<INPUT name="btnSelDelPath" onclick="on_btnSelDelPath()" type="button" value="选择">
				<INPUT name="btnDeletePath" onclick="on_btnDeletePath()" type="button" value="删除">
			</TD>
			<br>
		</fieldset>		
		<br> <br>
		<legend>二.设备文件操作</legend>
		<br> <br>
		<fieldset>
			<td>设备文件列表</td><br>
			<table>
				<colgroup>
					<col class="col1">
					<col class="col2">
					<col class="col3">
				</colgroup><tbody>
					<tr>
						<td></td>
						<td></td>
						<td></td>
					</tr>
					<tr>
						<td colspan="2"><select id="selDeviceFiles" name="selDeviceFiles" onchange="OnSelDeviceFileChanged()"></select></td>
					<td>
						<input name="btnRefresh"  class="keyBtn" onclick="OnRefreshDeviceFile()" type="button" value="获取文件列表">
					</td>
					</tr>
				</tbody>
			</table>
			<td>文件名：</td>
			<TEXTAREA name="txtDeviceFileName" rows="1" cols="70"></TEXTAREA>
			<td>文件内容：</td><br>
			<tr>
				<TEXTAREA name="txtDeviceFileContent" rows="5" cols="70">测试原文。Test plain text. 1234567890~！@#￥%……&amp;*（）</TEXTAREA>
				<td>
					<input name="btnWriteFileToDevice" class="keyBtn" onclick="on_btnWriteFileToDevice()" type="button" value="写入">
					<input name="btnReadFileFromDevice" class="keyBtn" onclick="on_btnReadFileFromDevice()" type="button" value="读取">
					<input name="btnDeleteFileFromDevice" class="keyBtn" onclick="on_btnDeleteFileFromDevice()" type="button" value="删除">
				</td>
			</tr>
		</fieldset>	
		<div id="result"></div>
	</form>
</body>
</html>